<template>
  <form id="form1">
	  <div id="container">
        <div class="content">
          <div class="tit">
            <a>首页</a>&gt;
            <a>院士大师风采</a>
          </div>
          <div class="news">
            <div class="about_r">
              <div class="newsinfo">
                <div class="master">
                  <h3 class="masterTitle">{{name}}</h3>
                  <hr>
                  <!-- <dl class="masterPerson" data-type="1003" data-id="3362"> -->
                  <dl class="masterPerson" v-for="item in list">
                    <a :href="'/newsview?type=2&id='+item.id">
                      <dt>
                        <img style="width: 150px;height: 150px;"
                          :src="item.img">
                      </dt>
                      <dd>{{item.name}}</dd>
                      <dd class="personUnit">
                      </dd>
                    </a>
                  </dl>
                </div>
              </div>
            </div>
            <div class="about_l">
              <div class="submenu">
                <div class="suntit">院士大师风采</div>
                <ul>
                  <li v-for="item in collegeList" 
                      :class="item.name == name ? 'current': ''">
                    <a @click="yuanshiLoad(item)">
                      <p>{{item.name}}</p>
                    </a>
                  </li>
                </ul>
              </div>
              <!-- 推荐招标 -->
              <div class="zhaobiao">
                <a>
                  <img src="https://kancha-1258911605.cos.ap-guangzhou.myqcloud.com/front/zhaobiao.jpg">
                </a>
              </div>
              <!-- 推荐招标 -->
            </div>
          </div>
        </div>
      </div>
	</form>
</template>

<script>
import Data from '@/api/data'

export default {
  name: 'Index',
  props:{
    layout: String
  },
  data() {
    return {
      dictType: "COLLEGE",
      collegeList: [],

      name: "",
      list:[],
    }
  },
  watch: {
    month: {

    }

  },
  computed: {
  },
  created() {
    this.collegeLoad();
  },
  methods: {
    collegeLoad() {
      var data = {size:50,type: this.dictType};
      Data.get("/dictionary", data).then(res=>{
        console.log(res)
        this.collegeList = res.list
        if(res.list && res.list.length > 0) {
          this.yuanshiLoad(res.list[0])
        }
      })
    },
    yuanshiLoad(item) {
      var _this = this
      this.name = item.name
      this.list = []
      var list = item.value.split(";");

      var ids = []
      for(var i = 0; i < list.length; i++ ) {
        var id = list[i].split(":")[0]
        if(id) {
          ids.push(id)
        }
      }
      if(ids.length > 0) {
        console.log(ids)
        Data.get("/person/listByIds", {ids: ids.join(",")}).then(res=>{
          console.log(res)
          if(res) {
            _this.list = res
          }
          console.log(_this.list)
        })
      }
    },
    async fetchList() {
      console.log("请求参数",this.listQuery)
      const res = await Data.get("/article", this.listQuery)
      if (res) {
        this.list = res.list
        this.total = res.total
      }
    },

  }
}
</script>

<style lang="scss" scoped>
@import "~@/styles/new_files/bootstrap.min.css";
@import "~@/styles/new_files/iconfont.css";
@import "~@/styles/new_files/comm.css";
@import "~@/styles/new_files/info.css";
</style>
